def count_days(year, month, day):
    # 每个月有多少天
    month_day = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
    # 判断是否是闰年
    if (year % 4 == 0 and year % 100 != 0) or year % 400 == 0:
        leap_year = 1
    else:
        leap_year = 0

    result = sum(month_day[:month - 1]) + day + leap_year
    return result


import datetime


def func3(year, month, day):
    date = datetime.date(year, month, day)
    return date.strftime('%j')  # %j十进制表示的每年的第几天


print(func3(2019, 6, 20))  # 171
